/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

package lesson3.com.demo.inner.local;

import lesson3.com.demo.inner.member.*;
import lesson3.com.demo.inner.not.*;

// called a "top-level" class, can be public or p-f ONLY
public class Car {
    
    private float fuelLevel;
    private Engine eng;
    

    public Engine createEngine(){    
        if(eng!=null){
            return eng;
        }
        final int x=6; // outside of createEngine there is no "x"
                       // must be final in order for CarEngine to use it
        // local inner class, no public, no protected, no private
        class CarEngine implements Engine {

            @Override
            public void rev() {
                fuelLevel-=0.05F;
                int m = x;
                System.out.println("The Value of m is "+m);
                System.out.println("The Value of x is "+x);
            }
            
        }
        return eng=new CarEngine();
    }
    
    public void run(){
        // affect fuelLevel;
        fuelLevel-=0.02F;
    }
    
    public void addGas(float amount, double moneyMoneyMoney){
        // check money... THEN
        fuelLevel+=amount;
    }
    
    public float siphonTankForLawnMower(float  amount){
        fuelLevel-=amount;
        return fuelLevel;
    }
    
    public float getFuelLevel(){
        return fuelLevel;
    }
    
   
    

}
